﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data;
using Frame.Lib.Core.Base;
using Frame.Lib.Utilities;
using Frame.Lib.Core;

namespace Jzy.DAL.HR
{
    public class EmployeeDAL:BaseDAL
    {
        //public string GetIDByUserID(int userID)
        //{
        //    DataTable dt = dbOper.ExecuteQuery("select ID from Employee where UserID = @p0", userID);
        //    if (dt.Rows.Count > 0)
        //    {
        //        return dt.Rows[0]["ID"].ToString();
        //    }
        //    else
        //    {
        //        return null;
        //    }

        //}

        //public void Save(Jzy.Model.EmployeeInfo info)
        //{
        //    throw new NotImplementedException();
        //}

        public DataTable GetContactList(List<int> deptIDs)
        {
            string strDeptIDs = ConvertUtil.ConvertToDbStr(deptIDs);
            string sql = "select a.ID, LoginName, a.Name, OfficePhone, Mobile, MSN, QQ, Email,Photo,a.Orders,Notes,HireDate,Address from " + OTableName.Employee + " as a inner join " + STableName.User + " as b on a.ID = b.ID where a.ID in (select UserID from " + STableName.DeptUser + " where DeptID in (" + strDeptIDs + "))";
            DataTable dt = dbOper.Query(sql);
            return dt;
        }
    }
}
